package com.iss.lxhproject.service;

import com.iss.lxhproject.dao.UserDao;
import com.iss.lxhproject.entity.User;
import com.iss.lxhproject.model.UserWithRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserDao userDao;

    public UserWithRole login(User user){
       return userDao.login(user);
    }

    public Boolean register(User user){
        Integer count = userDao.register(user);
        if(count>1){
            return true;
        } else {
            return false;
        }
    }

    public Boolean CheckUserName(String u_name){
        User user = userDao.CheckUserNameExit(u_name);
        if(user==null){
            return false;
        }else{
            return true;
        }
    }
}
